{% extends "home.html" %}
{% block header %}FoodExpert - New Recipe{% endblock %}
{% block title %} {% endblock %}
{% block navpanel %}
  <ul>
  <li id="bt_back" class="button"><a href="/"><span>Back</span></a></li>
  <li id="bt_profile" class="button"><a href="/profile/user"><span>My Profile</span></a></li>
  {% if is_user_admin %}
    <li id="bt_admin_users" class="button"><a href="/admin/user/list"><span>Users List</span></a></li>
    <li id="bt_admin_recipes" class="button"><span>Recipes List</span></li>
  {% endif%}
  </ul>
{% endblock %}
{% block main%}
  <header>
    <h2>{{ formName }}</h2>
  </header>
  <panel>
    <div id="bt_add_recipe" class="button"> <a href="/admin/recipes/add"> Add </a></div>
    <div id="bt_back" class="button"> <a href="/admin/recipes/list?from={{ back_pos }}"> &lt;&lt; </a></div> <span>{{ list_len }}</span>
    <div id="bt_next" class="button"> <a href="/admin/recipes/list?from={{ next_pos }}"> &gt;&gt; </a></div>
  </panel>
  <lo>
    {% for r in recipes %}
    <li>
      <recipe>
        <name>{{r.name}}
        <form action="/admin/recipes/edit" method="post">
          <input type="hidden" name="key" value="{{r.key}}" />
          <input type="submit" name="edit" value="edit" />
        </form>
        <form action="/admin/recipes/delete" method="post">
          <input type="hidden" name="key" value="{{r.key}}" />
          <input type="submit" name="delete" value="delete" />
        </form></name>
        <description> {{r.descript}} {% if r.is_deleted %}<b>deleted</b>{% endif %}</description>
      </recipe>
    </li> 
    {% endfor %}
  </lo>
{% endblock %}
